package test1223;

public class Test11 {
    public static void main(String[] args) {
        // ABCDE=4*EDCBA;其中，A、B、C、D、E都是1-9中的数字。问这5个数字都是多少。
        // 穷举A, B, C, D, E的值，找到符合条件的解
        for (int A = 1; A <= 9; A++) {
            for (int B = 1; B <= 9; B++) {
                for (int C = 1; C <= 9; C++) {
                    for (int D = 1; D <= 9; D++) {
                        for (int E = 1; E <= 9; E++) {
                            // 计算ABCDE和EDCBA
                            int ABCDE = 10000 * A + 1000 * B + 100 * C + 10 * D + E;
                            int EDCBA = 10000 * E + 1000 * D + 100 * C + 10 * B + A;

                            // 判断是否满足条件
                            if (ABCDE == 4 * EDCBA) {
                                System.out.println("A=" + A + ", B=" + B + ", C=" + C + ", D=" + D + ", E=" + E);
                            }
                        }
                    }
                }
            }
        }
    }
}
